<%@ page contentType="text/html;charset=UTF-8" isELIgnored="false" autoFlush="true"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<span class="title1">修改密码</span>
<table class="qlist" width="100%" align="center" cellpadding="0" cellspacing="0" style="background-color:#FAFCFC;border:1px solid #ccc;">
    <html:form action="/user" method="post" onsubmit="return validate(this);" focus="opassword">
    <html:hidden property="action" value="changepassword"/>
    <tr>
        <td align="right">登陆名</td>
        <td>
            <c:out value="${user_session.loginName}"/>
        </td>
    </tr> 
    <tr>
        <td align="right">原密码</td>
        <td>
            <input type="password" name="opassword" size="12" maxlength="12" value=""/>*(12个字符（包括数字,_）)
        </td>
    </tr> 
    <tr>
        <td align="right">新密码</td>
        <td>
            <html:password property="password" size="12" maxlength="12" value=""/>*(12个字符（包括数字,_）)
        </td>
    </tr> 
    <tr>
        <td align="right">新密码验证</td>
        <td>
            <input type="password" name="password1" size="12" maxlength="12"/>*(必须和[新密码]相同)
        </td>
    </tr> 
    <tr>
        <td align="right">验证码</td>
        <td>
            <input type="text" name="vc" value="" size="8">*<img src="<%=request.getContextPath()%>/vcimg" width="40" height="20" border="0" align="absbottom"/>
        </td>
    </tr>
    <tr>
        <td align="right"></td>
        <td>
            <input type="submit" value="submit"/>
        </td>
    </tr>
    </html:form>
</table>
<script type="text/javascript">
    function validate(pForm)
    {
        var opassword = pForm.opassword.value;
        if(opassword == "")
        {
            alert("[原密码]必须");
            pForm.opassword.focus();
            return false;        
        }
        var password = pForm.password.value;
        if(password == "" || password.length < 6)
        {
            alert("[新密码]必须，且不小于6位");
            pForm.password.focus();
            return false;        
        }
        var password1 = pForm.password1.value;
        if(password != password1)
        {
            alert("[新密码]和[新密码验证]必须相同");
            pForm.password1.focus();
            return false;        
        }
        var vc = pForm.vc.value;
        if(vc == "" || vc.length < 4)
        {
            alert("[验证码]必须输入");
            pForm.vc.focus();
            return false;        
        }

        return true;
    }
    function checkLoginName(pLink)
    {
        
        if(document.user.loginName.value == "")
        {
            alert("请输入登陆名！");return false;
        }
        var link = "<%=request.getContextPath()%>/user.mrqa?action=checkloginnameifexist";
        pLink.href =link+"&loginName="+document.user.loginName.value;
        return true;
        
    }
</script>